import { IFeidaoAiBrowserComponent } from '@feidao/web/interfaces';

/*
* 获取 exam_name 和 exam_id
*/
export default async function (fd: IFeidaoAiBrowserComponent, ...args: any[]) {

	const select_node = document.querySelector<HTMLSelectElement>('[data-feidao-id="exam_select"]');
	const teacher_name_node = document.querySelector<HTMLInputElement>('[data-feidao-id="teacher_name"]');
	const s_index = select_node.selectedIndex;
	const option_node = select_node[s_index] as HTMLOptionElement;
	console.log(option_node.dataset.feidaoName);
	fd.data.exam_name = option_node.dataset.feidaoName;
	fd.data.exam_id = option_node.dataset.feidaoId;
	fd.data.teacher_name = teacher_name_node.value;

	fd.data.criteria = { exam_id: fd.data.exam_id };
	fd.data.page_no = 1;
}